package com.example.hibernate.u.n1;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;

@Entity
@SequenceGenerator(name = "seq_emp", sequenceName = "seq_emp")
public class Employee {

	private Long id;
	private String name;
	private Department dept;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="dept_id")
	public Department getDept() {
		return dept;
	}

	@Id
	@GeneratedValue(generator = "seq_emp")
	public Long getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public void setDept(Department dept) {
		this.dept = dept;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setName(String name) {
		this.name = name;
	}

}
